package com.jgame.secondarymarket.domain.auth.service;

import com.jgame.secondarymarket.domain.account.repository.AccountRepository;
import com.jgame.secondarymarket.domain.auth.repository.AuthenticAccountRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

/**
 * @title: AuthenticAccountDetailsService
 * @Author Wangsj
 * @Date: 2021/7/27
 */
@Component
public class AuthenticAccountDetailsService implements UserDetailsService {

    @Autowired
    AuthenticAccountRepository accountRepository;


    @Override
    public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
        return accountRepository.findByUsername(s);
    }
}
